﻿/*
	Copyright © Bogdan Kobets 2011
	http://ElasticLogic.com
*/

using System.Collections.Generic;

namespace ElasticLogic.TagsMarker.Concepts
{

	public class Tag<E> : Label
		where E : class
	{

		private Tag()
			: base(true)
		{
		}

		public static Tag<E> Create(string caption)
		{
			Tag<E> tag = new Tag<E>();

			if (tag.SetCaption(caption))
				return tag;
			else
				return null;
		}

		public bool IsIncludedInCategory
		{
			get { return Marker<E>.IsTagIncludedInAnyCategory(this); }
		}

		public Category<E> Category
		{
			get { return Marker<E>.GetTagCategory(this); }
		}

		public bool IsIncludedInEntities
		{
			get { return Marker<E>.IsTagIncludedInEntities(this); }
		}

		public List<E> Entities
		{
			get { return Marker<E>.GetTagEntities(this); }
		}

		public bool IncludeInCategory(Category<E> category)
		{
			return Marker<E>.IncludeTagInCategory(this, category);
		}

		public bool ExcludeFromCategory()
		{
			return Marker<E>.ExcludeTagFromCategory(this);
		}

		public bool IncludeInEntity(E entity)
		{
			return Marker<E>.IncludeTagInEntity(this, entity);
		}

		public bool ExcludeFromEntity(E entity)
		{
			return Marker<E>.ExcludeTagFromEntity(this, entity);
		}

		public void ClearFromEntities()
		{
			Marker<E>.ClearTagFromEntities(this);
		}

		public void Remove()
		{
			Marker<E>.Tags.Remove(this);
		}

	}

}
